
#include "zen_game_scene.h"
#include "zen_game_activity.h"

namespace Zen
{
	namespace Game
	{
		void Group::OnReady(std::shared_ptr<RenderStack> rs, float interval)
		{
			if (mInnerNodes.empty()) return;
			this->SortInnerNodes();
			for (auto i : mInnerNodes)
			{
				i->OnReady(rs, interval);
			}
		}

		void Group::OnDraw()
		{
			Node::OnDraw();

			if (mInnerNodes.empty()) return;
			this->SortInnerNodes();
			for (auto i : mInnerNodes)
			{
				i->OnDraw();
			}
		}

		Scene::Scene()
		{
			mCamera = std::make_shared<Camera>();
		}

		std::shared_ptr<Camera> Scene::GetCamera()
		{
			return mCamera;
		}

		void Scene::OnReady(std::shared_ptr<RenderStack> rs, float interval)
		{
			rs->PushMatrix(&mCamera->GetMatrix(), mCamera->GetMatrixVersion());
			Group::OnReady(rs, interval);
			rs->PopMatrix();
		}

		void Scene::OnDraw()
		{
			Group::OnDraw();
		}

	} // namespace Game
} // namespace Zen
